package com.zlp.dto.test;

import cn.hutool.core.convert.Convert;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

@Data
@ToString
@EqualsAndHashCode(callSuper = false)
public class SupplierBaseDTO extends SupplierSkuDTO {

    /**
     * 主图
     */
    private String mainImgUrl;

    /**
     * 轮播图片列表
     */
    private List<String> scrollImgUrlList;

    /**
     * 内容详情
     */
    private List<String> detailImgUrlList;


    /**
     * 已售卡券到期时间列表
     */
    private List<String> expiresDateList;


    /**
     * 对象转换
     *
     * @param lhSupplierSkuResp 对象转换
     * @return com.zlp.dto.test.SupplierSkuDTO
     * @author ZouLiPing
     * @date 2022/10/8 13:55
     */
    public static SupplierBaseDTO convertBaseSupplierSku(LhSupplierSkuResp lhSupplierSkuResp) {
        SupplierBaseDTO supplierBaseDTO = new SupplierBaseDTO();
        supplierBaseDTO.setSkuName(lhSupplierSkuResp.getSkuName());
        supplierBaseDTO.setSkuNo(lhSupplierSkuResp.getSkuNo());
        supplierBaseDTO.setStockNum(lhSupplierSkuResp.getStock());
        // 主图
        supplierBaseDTO.setMainImgUrl(lhSupplierSkuResp.getThumb());
        if (StringUtils.isNotBlank(lhSupplierSkuResp.getDetailImgList())) {
            supplierBaseDTO.setDetailImgUrlList(Convert.toList(String.class, lhSupplierSkuResp.getDetailImgList()));
        }
        if (StringUtils.isNotBlank(lhSupplierSkuResp.getImgList())) {
            supplierBaseDTO.setScrollImgUrlList(Convert.toList(String.class, lhSupplierSkuResp.getImgList()));
        }
        return supplierBaseDTO;
    }


}
